package com.zh.push.jpush;

import cn.jiguang.common.ClientConfig;
import cn.jpush.api.JPushClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

/**
 * 自动注入 JPushClient 极光配置
 * Created by lds
 */
@Component
@Lazy
public class JpushInstanceConfig {

    @Autowired
    private JpushConfig jpushConfig;

    @Bean
    public JPushClient jpushClient() {
        JPushClient jpushClient = new JPushClient(jpushConfig.getMasterSecret(), jpushConfig.getAppKey(), null, ClientConfig.getInstance());
        return jpushClient;
    }
}